home *** CD-ROM | disk | FTP | other *** search
/ CD-ROM Magazine 28 Bonus / CDRomMagazine-SoftKey-ArtPassion-FrenchVersion-Win31Mac.bin / data / shared.dir / 03025_Script_MENU HANDLERS < prev    next >
Text File  |  1996-06-21  |  8KB  |  266 lines

  1. -- --------------------------------------------------------------------------------------
  2. -- Handler initMenu 
  3.  
  4. on initMenu
  5.   -- difference between the top of the menubutton and the bottom of the
  6.   -- menubar
  7.   global menuBarOffset
  8.   set menuBarOffset = 1
  9.   
  10.   global MenuEnableList
  11.   set MenuEnableList = []
  12.   setMenuItemEnable 1, TRUE
  13.   setMenuItemEnable 2, TRUE
  14.   setMenuItemEnable 3, TRUE
  15.   setMenuItemEnable 4, TRUE
  16.   setMenuItemEnable 5, TRUE
  17.   setMenuItemEnable 6, TRUE
  18.   setMenuItemEnable 7, TRUE
  19.   hideMenu
  20. end
  21.  
  22. -- --------------------------------------------------------------------------------------
  23. -- Handler checkMenuButtonRoll checks if the user rolled over the menu button and, if so,
  24. -- hilites the currently rolled-over segment.
  25.  
  26. on checkMenuButtonRoll mousePoint
  27.   global menuBar, menuVisible, menuButtonRect
  28.   
  29.   if (NOT menuVisible) AND (inside(mousePoint, menuButtonRect)) then
  30.     showMenu
  31.   else if menuVisible then
  32.     if (NOT rollover(menuBar)) AND (NOT inside(mousePoint, menuButtonRect)) then
  33.       hideMenu
  34.     else
  35.       doMenuRoll
  36.     end if
  37.   end if
  38. end
  39.  
  40. -- --------------------------------------------------------------------------------------
  41. -- Handler showMenu 
  42.  
  43. on showMenu
  44.   global menuBar, menuVisible, fingerCursor, menuH, menuV
  45.   
  46.   set the locH of sprite menuBar = menuH
  47.   set the locV of sprite menuBar = menuV
  48.   set the cursor of sprite menuBar = fingerCursor
  49.   set menuVisible = 1
  50.   updateStage
  51. end
  52.  
  53. -- --------------------------------------------------------------------------------------
  54. -- Handler hideMenu 
  55.  
  56. on hideMenu 
  57.   global menuBar, menuVisible, hilitMenuSeg
  58.   
  59.   removeFromStage(menuBar)
  60.   removeFromStage(hilitMenuSeg)
  61.   set the cursor of sprite menuBar = -1
  62.   set menuVisible = 0
  63.   setHilitedMenuItem 0
  64.   updateStage
  65. end
  66.  
  67. -- --------------------------------------------------------------------------------------
  68. -- Handler doMenuClicked determines what menu item the user clicked
  69. -- and sends an appropriate message to the handler processMenuClick.
  70.  
  71. on doMenuClicked
  72.   global numMenuItems, menuBar, hilitMenuSeg
  73.   
  74.   set aSeg = getVButtonIndexOffSet(menuBar, numMenuItems, the mouseV)
  75.   activateButton(hilitMenuSeg)
  76.   updateStage
  77.   processMenuClick aSeg
  78. end
  79.  
  80. -- --------------------------------------------------------------------------------------
  81. -- Handler doMenuRoll 
  82.  
  83. on doMenuRoll
  84.   global numMenuItems, menuBar
  85.   
  86.   hiliteMenuItem ( getVButtonIndexOffSet(menuBar, numMenuItems, the mouseV))
  87. end 
  88.  
  89. -- --------------------------------------------------------------------------------------
  90. -- Handler hiliteMenuItem 
  91.  
  92. on hiliteMenuItem aSeg
  93.   global menuBar, menuHiliteLocations, hilitMenuSeg
  94.   
  95.   -- if the currently rolledover item (aSeg) is not already hilited and the 
  96.   -- currently rolledover item (aSeg) is enabled, hilite it
  97.   if NOT (getHilitedMenuItem() = aSeg) then
  98.     setHilitedMenuItem aSeg
  99.     
  100.     if IsEnabledMenuItem(aSeg) then
  101.       set the castNum of sprite hilitMenuSeg = the number of cast ("hiliteSeg" & aSeg)
  102.       set the locH of sprite hilitMenuSeg = value(item 1 of line aseg of menuHiliteLocations)
  103.       set the locV of sprite hilitMenuSeg = value(item 2 of line aseg of menuHiliteLocations)
  104.     else
  105.       removeFromStage(hilitMenuSeg)
  106.     end if
  107.   end if
  108. end
  109.  
  110. -- --------------------------------------------------------------------------------------
  111. -- Handler IsEnabledMenuItem 
  112.  
  113. on IsEnabledMenuItem whichItem
  114.   global numMenuItems, MenuEnableList
  115.   
  116.   if (whichItem < 1) OR (whichItem > numMenuItems) then
  117.     return FALSE
  118.   else
  119.     return getAt(MenuEnableList, whichItem)
  120.   end if
  121. end
  122.  
  123. -- --------------------------------------------------------------------------------------
  124. -- Handler setMenuItemEnable 
  125.  
  126. on setMenuItemEnable whichItem, trueOrFalse
  127.   global MenuEnableList
  128.   setAt MenuEnableList, whichItem, trueOrFalse
  129. end
  130.  
  131. -- --------------------------------------------------------------------------------------
  132. -- Handler getHilitedMenuItem 
  133.  
  134. on getHilitedMenuItem
  135.   global currentHilitedMenuItem
  136.   
  137.   return currentHilitedMenuItem
  138. end
  139.  
  140. -- --------------------------------------------------------------------------------------
  141. -- Handler setHilitedMenuItem 
  142.  
  143. on setHilitedMenuItem whichItem
  144.   global currentHilitedMenuItem
  145.   
  146.   set currentHilitedMenuItem = whichItem
  147. end
  148.  
  149. -- --------------------------------------------------------------------------------------
  150. -- Handler processMenuClick executes whatever item the user clicked on the menu.
  151.  
  152. on processMenuClick itemClicked
  153.   global menuVisible
  154.   
  155.   set menuVisible = FALSE
  156.   if itemClicked = 1 then
  157.     goMain
  158.   else if itemClicked = 2 then
  159.     goTour
  160.   else if itemClicked = 3 then
  161.     goIndex
  162.   else if itemClicked = 4 then
  163.     goHelp
  164.   else if itemClicked = 5 then
  165.     goDataBase
  166.   else if itemClicked = 6 then
  167.     goTimeLine
  168.   else if itemClicked = 7 then
  169.     DoQuit
  170.   end if
  171. end
  172.  
  173. -- ---------------------------------------------------------------
  174. -- Handler goTimeLine 
  175. on goTimeLine
  176.   goSection ("TLmain1",1)
  177. end
  178.  
  179. -- ---------------------------------------------------------------
  180. -- Handler goPrevScene is called when the user 
  181.  
  182. on goPrevScene
  183.   global backFrame, backMovie
  184.   goScene(backFrame,backMovie)
  185. end
  186.  
  187. -- ---------------------------------------------------------------
  188. -- Handler goMain is called when the user clicks Main on the
  189. -- menu bar. It takes the user to the main world.
  190.  
  191. on goMain
  192.   goSection("CR1",1)
  193. end
  194.  
  195. -- ---------------------------------------------------------------
  196. -- Handler goTour is the handler use to go from one section in
  197. -- the product to another.
  198.  
  199. on goTour 
  200.   global currentsection
  201.   
  202.   setMouseDownScriptEmpty -- Added by ET Oct. 2, 95
  203.   
  204.   addSectionToBackList(currentsection)
  205.   setBackFlag(FALSE)
  206.   setSectionButtonCursors("-1") -- reset the cursors of the old section
  207.   turnOffPuppet
  208.   goMovie("ArtTour.dir", "TourSt")
  209. end
  210.  
  211. -- ---------------------------------------------------------------
  212. -- Handler goIndex is called when the user clicks Index on the
  213. -- menu bar. It takes the user to the index.
  214.  
  215. on goIndex
  216.   goSection ("IXmain1",1)
  217. end
  218. -- ---------------------------------------------------------------
  219. -- Handler doQuit is called when the user clicks Quit on the
  220. -- menu bar. It quits the program.
  221.  
  222. on doQuit
  223.   global sectionmovie
  224.   if sectionmovie = "ArtCredt.dir" then
  225.     unblackoutscreen
  226.     quit
  227.   else
  228.     goMovie ("ArtCredt.dir","StartCred")
  229.     set sectionmovie = "ArtCredt.dir"
  230.   end if
  231.   
  232. end
  233.  
  234. -- ---------------------------------------------------------------
  235. -- Handler goHelp is called when the user clicks Help on the
  236. -- menu bar. It takes the user to the help section.
  237.  
  238. on goHelp
  239.   goSection ("HelpSt",1)
  240. end
  241.  
  242. -- ---------------------------------------------------------------
  243. -- Handler goDatabase is called when the user clicks Database on the
  244. -- menu bar. It takes the user to the database.
  245.  
  246. on goDatabase
  247.   goSection ("DBst",1)
  248. end
  249.  
  250. -- --------------------------------------------------------------------------------------
  251. -- Handler setUpMenu is called from goSection. It resets values at the beginning of
  252. -- a new section.
  253.  
  254. on setUpMenu
  255.   global menuBar, menuVisible, hilitMenuSeg
  256.   
  257.   set the castNum of sprite menuBar = the number of cast "hiliteSeg0"
  258.   puppetSprite menuBar, TRUE
  259.   puppetSprite hilitMenuSeg, TRUE
  260.   removeFromStage(menuBar)
  261.   removeFromStage(hilitMenuSeg)
  262.   set menuVisible = FALSE
  263. end
  264.  
  265. --
  266.